package 设计模式.q_访问者模式;

import java.util.Arrays;

/**
 * 军队等级单位
 * 
 * @author caihe
 * @date 2023/3/21 16:25
 */
public abstract class Unit {
    
    private final Unit[] children;
    
    public Unit(Unit... children) {
        this.children = children;
    }
    
    public void accept(UnitVisitor unitVisitor) {
        for (Unit children : children) {
            children.accept(unitVisitor);
        }
    }
    
}
